<?php
/**
 * 观察者模式 测试
 */

include "autoload.php";

//use utils\Integer;
//printf("%s\n", Integer::toHexString(172));
//printf("%s\n", Integer::toBinaryString(172));
//printf("%s\n", Integer::toOctalString(172));

use DesignPatterns\Behavioral\Observer\Subject;
use DesignPatterns\Behavioral\Observer\BinaryObserver;
use DesignPatterns\Behavioral\Observer\OctalObserver;
use DesignPatterns\Behavioral\Observer\HexObserver;

$subject = new Subject();

new BinaryObserver($subject);
new OctalObserver($subject);
new HexObserver($subject);

printf("\nFirst state change: 15\n");
$subject->setState(15);

printf("\nSecond state change: 10\n");
$subject->setState(10);

printf("\nThird state change: 172\n");
$subject->setState(172);



